package yunplus.io.hchome.display.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.Button;
import android.widget.EditText;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import yunplus.io.hchome.R;
import yunplus.io.hchome.display.video.DeviceInfo;
import yunplus.io.hchome.presenter.implement.ConnectPresenter;

/**
 * Created by cruze on 2017/6/25.
 */

public class ConnectActivity extends BaseActivity {

    @BindView(R.id.et_name)
    EditText etName;

    @BindView(R.id.et_uname)
    EditText etUName;

    @BindView(R.id.et_pwd)
    EditText etPwd;

    @BindView(R.id.et_address)
    EditText etAddress;

    @BindView(R.id.et_port)
    EditText etPort;

    @BindView(R.id.btn_connect)
    Button btnCon;


    private ConnectPresenter presenter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ButterKnife.bind(this);
        setContentView(R.layout.activity_connect);

        presenter = new ConnectPresenter(this.getApplicationContext());
    }

    @OnClick(R.id.btn_connect)
    public void onConnectClicked(){

        DeviceInfo info = new DeviceInfo();
        info.setUsername(etUName.getText().toString().trim());
        info.setPasswd(etPwd.getText().toString().trim());
        info.setAddress(etAddress.getText().toString().trim());
        info.setPort(Integer.valueOf(etPort.getText().toString().trim()));
        presenter.connect(info);

    }



}
